package javaCode;

/**
 * Created by lxy_920912 on 03/05/2017.
 */
public class LeetCode485 {
    public int findMaxConsecutiveOnes(int[] nums) {
        int max = 0;
        int count = 0;
        for(int i = 0;i < nums.length;i++){
            while (nums[i] == 0){
                i++;
                count = 0;
                continue;
                }

            count++;
            if(count > max) {
                max = count;
            }


        }
        return  max;
    }
}
